<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xn="http://www.renren.com/2009/xnml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="{{ staticUrl }}/css/paper.css?ver={{ cssVersion }}" rel="stylesheet" type="text/css" media="all" />
</head>
<body>
{% if errMsg %}
    <p class="err_msg">{{ errMsg }}</p>
{% endif %}
<div class="paper_content">{{ content }}</div>

<script type="text/javascript">
    window.HostName = {IE:0, MOZILLA:1, SAFARI:2, OPERA:3, OTHER:4};
    function getHostName() {
        var userAgent = window.navigator.userAgent.toLowerCase();
        var hostName = HostName.OTHER;
        if (userAgent.indexOf("msie") != -1) {
		    hostName = HostName.IE;
        } 
        else {
            if (userAgent.indexOf("firefox") != -1) {
                hostName = HostName.MOZILLA;
            } else {
                if (userAgent.indexOf("safari") != -1) {
                    hostName = HostName.SAFARI;
                } 
                else if (userAgent.indexOf("opera") != -1) {
                    hostName = HostName.OPERA;
                }
                else if (userAgent.indexOf("gecko") != -1) {
                        hostName = HostName.MOZILLA;
                }
            }
        }
        return hostName;
    }
    function computeDocumentHeight() {
        var body = document.body;
        var docElement = document.documentElement;
        var height = {{ initialIframeHeight }};
        if (getHostName() == HostName.IE) {
            height = body.scrollHeight;
        }
        else if (docElement) {
            height = docElement.offsetHeight;
        }
        else {
            height = body.scrollHeight;
        }
        return height;
    }
    function syncIframeHeight() {
        var newHeight = computeDocumentHeight();
        if (top != window) {
            top.syncIframeHeight(newHeight);
        }
    }
    setInterval(syncIframeHeight, 1000);
</script>
</body>
</html>
